import { AudioManager } from "./AudioManager";
import { Constants } from "../data/Constants";
import { BaseValue } from "../data/BaseValue";
import { FishManager } from "./FishManager";

const { ccclass, property } = cc._decorator;

@ccclass
export class SkillManager extends cc.Component {

    @property({
        type: FishManager
    })
    fishManager: FishManager = null;

    /**
     * 自动射击,点击一次开启则下一次关闭
     */
    public cannonAutoShot() {
        AudioManager.playEffect(Constants.EffectSource.GUN_LOAD);
        if (BaseValue.IS_FIRE) {
            BaseValue.IS_FIRE = false;
        } else {
            BaseValue.IS_FIRE = true;
        }
    }

    public fishFrozen() {
        AudioManager.playEffect(Constants.EffectSource.FROZEN);
        BaseValue.IS_FROZEN = true;
        this.fishManager.controlMoving(false);
    }

}
